using Verse;

namespace RimWorld.BaseGen;

public class SymbolResolver_BasePart_Outdoors_LeafDecorated_RandomInnerRect : SymbolResolver
{
	private const int MinLength = 5;

	private const int MaxRectSize = 15;

	public override bool CanResolve(ResolveParams rp)
	{
		if (base.CanResolve(rp) && rp.rect.Width <= 15 && rp.rect.Height <= 15 && rp.rect.Width > 5)
		{
			return rp.rect.Height > 5;
		}
		return false;
	}

	public override void Resolve(ResolveParams rp)
	{
		int num = Rand.RangeInclusive(5, rp.rect.Width - 1);
		int num2 = Rand.RangeInclusive(5, rp.rect.Height - 1);
		int num3 = Rand.RangeInclusive(0, rp.rect.Width - num);
		int num4 = Rand.RangeInclusive(0, rp.rect.Height - num2);
		ResolveParams resolveParams = rp;
		resolveParams.rect = new CellRect(rp.rect.minX + num3, rp.rect.minZ + num4, num, num2);
		BaseGen.symbolStack.Push("basePart_outdoors_leaf", resolveParams);
	}
}
